﻿using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Construction.Core
{
    public class nConstruction: cObj, IList, ICollection
    {
        private string name;
        private static readonly nConstruction current = new nConstruction();        
        private List<nStories> contents;

        public static nConstruction Current
        {
            get { return current; }
        }

        public nConstruction()
        {
            this.contents = new List<nStories>();
        }

        public string Name
        {
            set
            {
                if (!(this.name == value))
                {
                    this.name = value;
                    base.Name = value;
                    this.node.Text = value;
                }
            }
            get
            {
                if (this.name == null)
                {
                    this.name = "[Tên công trình]";
                }
                return this.name;
            }
        }

        public List<nStories> ListStories
        {
            get
            {
                return (from e in this.contents
                        where e is nStories
                        select e as nStories).ToList<nStories>();
            }
        }
        public void Add(object value, int index)
        {
            nStories stories = value as nStories;
            this.contents.Insert(index, stories);
        }

        public int Add(nStories stories)
        {
            this.contents.Add(stories);
            stories.OwnerID = base.BaseID;
            return (this.contents.Count - 1);
        }        
        
        public void CopyTo(Array array, int index)
        {
            throw new NotImplementedException();
        }

        public int Count
        {
            get { return this.contents.Count; }
        }

        public bool IsSynchronized
        {
            get { throw new NotImplementedException(); }
        }

        public object SyncRoot
        {
            get { throw new NotImplementedException(); }
        }

        public IEnumerator GetEnumerator()
        {
            throw new NotImplementedException();
        }

        public int Add(object value)
        {
            throw new NotImplementedException();
        }

        public void Clear()
        {
            this.contents.Clear();
        }

        public bool Contains(object value)
        {
            throw new NotImplementedException();
        }

        public int IndexOf(object value)
        {
            throw new NotImplementedException();
        }

        public void Insert(int index, object value)
        {
            throw new NotImplementedException();
        }

        public bool IsFixedSize
        {
            get { throw new NotImplementedException(); }
        }

        public bool IsReadOnly
        {
            get { throw new NotImplementedException(); }
        }

        public void Remove(object value)
        {
            throw new NotImplementedException();
        }

        public void RemoveAt(int index)
        {
            throw new NotImplementedException();
        }

        public object this[int index]
        {
            get
            {
                throw new NotImplementedException();
            }
            set
            {
                throw new NotImplementedException();
            }
        }
    }
}
